package com.njtoyo.taxi.admin.rest.controller.data;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njtoyo.taxi.admin.rest.presenter.business.driver_withdraw.DriverWithdrawListPresenter;
import com.njtoyo.taxi.admin.rest.wrapper.business.driver_withdraw.IndexWrapper;
import com.njtoyo.taxi.admin.service.data.AllowanceStatisticsService;
import com.njtoyo.taxi.entity.backend.AdminUser;
import com.taxi.entity.common.RestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;


@RequestMapping("/data/allowance/statistic")
@RestController
public class AllowanceStatisticsController {

    @Autowired
    private AllowanceStatisticsService allowanceStatisticsService;

    /**
     * 免佣卡-饼图数据
     *
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/pie-chart")
    public RestResult pieChartData(@RequestParam("type") Integer type,
                                   @RequestParam(value = "startDate", required = false) String startDate,
                                   @RequestParam(value = "endDate", required = false) String endDate,
                                   @ModelAttribute("admin") AdminUser adminUser) {
        return allowanceStatisticsService.pieChartData(type, startDate, endDate, adminUser);
    }

    /**
     * 柱状图
     *
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/histogram-chart")
    public RestResult histogramChartData(@RequestParam("type") Integer type,
                                         @RequestParam(value = "startDate", required = false) String startDate,
                                         @RequestParam(value = "endDate", required = false) String endDate,
                                         @ModelAttribute("admin") AdminUser adminUser) {
        return allowanceStatisticsService.histogramChartData(type, startDate, endDate,adminUser);
    }

    @GetMapping("/getFreeCommissionPage")
    public RestResult getFreeCommissionPage(@RequestParam("type") Integer type,
                                            @RequestParam(value = "current", required = true, defaultValue = "1") Long current,
                                            @RequestParam(value = "size", required = true, defaultValue = "15") Long size,
                                            @RequestParam(value = "startDate", required = false) String startDate,
                                            @RequestParam(value = "endDate", required = false) String endDate,
                                            @ModelAttribute("admin") AdminUser adminUser) {
        return allowanceStatisticsService.getFreeCommissionPage(type, current, size, startDate, endDate,adminUser);
    }


}
